<template>
  <div class="box">
    <van-nav-bar
      title="就诊人信息"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-form>
      <van-cell-group inset>
        <van-field
          v-model="user.username"
          name="用户名"
          label="用户名"
          placeholder="用户名"
          :rules="[{ required: true, message: '请填写用户名' }]"
        />
        <van-field
          v-model="user.password"
          type="password"
          name="密码"
          label="密码"
          placeholder="密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <van-field
          v-model="user.nickname"
          name="昵称"
          label="昵称"
          placeholder="昵称"
          :rules="[{ required: true, message: '请填写昵称' }]"
        />
        <van-field
          v-model="user.age"
          name="年龄"
          label="年龄"
          placeholder="年龄"
          :rules="[{ required: true, message: '请填写年龄' }]"
        />
        <van-field
          v-model="user.sex"
          name="性别"
          label="性别"
          placeholder="性别"
          :rules="[{ required: true, message: '请填写性别' }]"
        />
        <van-field
          v-model="user.fullname"
          name="真实姓名"
          label="真实姓名"
          placeholder="真实姓名"
          :rules="[{ required: true, message: '请填写真实姓名' }]"
        />
      </van-cell-group>
      <div style="margin: 16px" class="register_btn">
        <van-button
          round
          block
          type="primary"
          native-type="submit"
          @click="ChangeUser(user)"
        >
          确认修改
        </van-button>
      </div>
    </van-form>
  </div>
</template>

<script setup lang="ts">
import { ChangeReq } from "../hooks/index";
const { user, ChangeUser } = ChangeReq();
// 返回上级
const onClickLeft = () => history.back();
</script>
<style lang="less" scoped>
.box {
  background: url(../../public/images/login.png);
  .van-form {
    margin-top: 218px;
  }
}
</style>
